﻿package planningsbord_v4 {
	
	import flash.display.MovieClip;
	import planningsbord_v4.model.Planningsbord;
	import planningsbord_v4.gui.PlanningsbordView;
	import flash.events.TUIO;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	
	/* 
	De class Apl is de hoofd class die het model en de gui van het 
	planningsbord maakt.
	*/
	public class Apl extends MovieClip {
		
		//private var xml:XML = new XML();
		//private var loader:URLLoader = new URLLoader();
		private var model:Planningsbord;
		
		public function Apl():void {
			
			// init TUIO
			TUIO.init(this,'localhost',3000, '',true);
			
			//loader.addEventListener(Event.COMPLETE, onLoaded);
			//loader.load(new URLRequest("database.xml"));
			
			model = new Planningsbord();
			model.addEventListener("modelLoaded", loadView);
		}
		
		private function loadView(e:Event){
			var view:PlanningsbordView = new PlanningsbordView(model, stage.stageWidth, stage.stageHeight);
			addChild(view);
		}
		
		
	}
}
